package com.yzr;

import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.async.AsyncLoggerContextSelector;
import org.junit.jupiter.api.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@Slf4j
@SpringBootApplication
public class LogApplication {

    public static void main(String[] args) {
        SpringApplication.run(LogApplication.class, args);
        // -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
        log.info("是否为异步日志：{}",AsyncLoggerContextSelector.isSelected());
        log.trace("trace");
        log.warn("warn");
        log.debug("debug");
        log.error("error");
        log.info("info");
    }

    @Test
    public void _1(){
        final Logger logger = LogManager.getLogger();
        logger.debug("debug");
        logger.error("error");
        logger.warn("warn");
        logger.info("info");
        logger.trace("trace");
    }

}
